#include "afw/afw.h"
#include "afw/afwwin.h"
#include "afw/afwfile.h"

#include "sageffile.h"
#include "sageform.h"

#include <winerror.h>
#include <winuser.h>
#include <stdio.h>

using namespace one_rag;
using namespace Sage;

int main(int argc, char* argv[])
{
  App theApp;
  MacBar bar; // creates a menu window that spans the top of the screen.
  bar.Create("Sage");

  return theApp.RunModal();

  if(argc != 2){
    printf("Usage: Sage.exe <filename.f>");
    return ERROR_INVALID_PARAMETER; // EXIT_FAILURE
  }

  File f;
  if(f.Open(argv[1],read|openexisting))
  {

    SageFFile data;
    data.Alloc(f.Size());
    if(f.Read(data,data.Size()))
    {
      App theApp; // create a GUI app

      SageForm main;

      main.CreateFor(data);

      return theApp.RunModal();

    }

    return EXIT_SUCCESS;
  }
  return GetLastError();
}
